package com.hung.tripleconsumer.controller;

import com.hung.triple.ResultDTO;
import com.hung.triple.bootstrap.annotation.TripleConsumer;
import com.hung.tripleconsumer.api.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Hung
 * @date 2022/9/24 15:10
 */
@Slf4j
@RestController
@RequestMapping("/display")
public class DisplayController {
    @TripleConsumer
    private HelloService helloService;

    @GetMapping("/sayHello")
    public ResultDTO<String> sayHello(String msg) {
        log.info("invoking.....");
        try {
            return helloService.sayHello(msg, System.currentTimeMillis());
        } catch (Exception e) {
            log.error("[Triple]", e);
            return ResultDTO.failed(e);
        }
    }

}
